package com.zhuang.pair;

import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;

public class PairDemo {

	public static void main(String[] args) {
		System.out.println("---------------------------Pair-----------------------------");
		Pair<String, String> pair = Pair.of("left", "right");
		System.out.println("left = " + pair.getLeft());
		System.out.println("right = " + pair.getRight());
		System.out.println("key = " + pair.getKey());
		System.out.println("value = " + pair.getValue());
		Pair<String, String> mutablePair = new MutablePair<>("left", "right");
		
		System.out.println("-----------------------mutablePair--------------------------");
		
		System.out.println("left = " + mutablePair.getLeft());
		System.out.println("right = " + mutablePair.getRight());
		System.out.println("key = " + mutablePair.getKey());
		System.out.println("value = " + mutablePair.getValue());
		Pair<String, String> immutablePair = new ImmutablePair<>("left", "right");
		
		System.out.println("-----------------------immutablePair------------------------");
		
		System.out.println("left = " + immutablePair.getLeft());
		System.out.println("right = " + immutablePair.getRight());
		System.out.println("key = " + immutablePair.getKey());
		System.out.println("value = " + immutablePair.getValue());
	}

}
